
const initState = {
  userInfo: {
    username: '',
    password: '',
    nickname: '',
    avatar: ''
  },
  token: '',
}

export const userReduce = (state = initState, action) => {
  if(action.type === 'loginSuccess') {
    return {
      ...state,
      userInfo: action.payload.userInfo,
      token: action.payload.token
    }
  }
  return state
}
